﻿using System.Windows.Forms;

namespace EAI.Office
{
    public partial class SettingForm : Form
    {
        public SettingForm()
        {
            InitializeComponent();

            LoadTreeView();
        }

        private void LoadTreeView()
        {
            foreach (string key in OfficeConfig.Instance.HashTable.Keys)
            {
                MailItem item = OfficeConfig.Instance.HashTable[key] as MailItem;

                if (!treeView1.Nodes.ContainsKey(item.Folder))
                {
                    TreeNode node = this.treeView1.Nodes.Add(item.Folder);
                }
            }
        }

        private void AddMailItem(MailItem item)
        {
            if (!treeView1.Nodes.ContainsKey(item.Folder))
            {
                TreeNode node = this.treeView1.Nodes.Add(item.Folder);
                node.Tag = item;
            }
        }
    }
}
